package com.yunji.coupon.dto;

import com.yunji.base.domain.BelongDO;
import com.yunji.base.dto.AgentDTO;
import com.yunji.common.enums.common.UserType;
import com.yunji.common.model.domain.SiteDO;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;

/**
 * @author : peter-zhu
 * @date : 2025/3/21 14:55
 * @description : TODO
 **/
@ToString
@Data
public class OrderScaleDTO {
    private Integer agentMode;
    private Integer tradeType;
    private Integer scaleType;
    private BigDecimal amt;
    private BigDecimal scale;
    private BigDecimal balance;

    private Long accountId;
    private String accountType;
    private String accountName;
    private String accountTel;

    public OrderScaleDTO(Integer agentMode, Integer tradeType, Integer scaleType, BigDecimal scale, BigDecimal amt) {
        this.agentMode = agentMode;
        this.tradeType = tradeType;
        this.amt = amt;
        this.scale = scale;
        this.scaleType = scaleType;
    }

    public OrderScaleDTO(Integer agentMode, Integer tradeType, Integer scaleType, BigDecimal scale, BigDecimal amt, AgentDTO agent) {
        this.agentMode = agentMode;
        this.tradeType = tradeType;
        this.amt = amt;
        this.scale = scale;
        this.scaleType = scaleType;
        this.accountId = agent.getBelongId();
        this.accountType = UserType.AGENT.getCode();
        this.accountName = agent.getAgentName();
        this.accountTel = agent.getAgentTel();
        this.balance = agent.getRemainAmount().add(amt);
    }

    public OrderScaleDTO(Integer agentMode, Integer tradeType, Integer scaleType, BigDecimal scale, BigDecimal amt, SiteDO site, BelongDO siteBelong) {
        this.agentMode = agentMode;
        this.tradeType = tradeType;
        this.amt = amt;
        this.scale = scale;
        this.scaleType = scaleType;
        this.accountId = site.getBelongId();
        this.accountType = UserType.SITE.getCode();
        this.accountName = site.getSiteName();
        this.accountTel = site.getSiteTel();
        this.balance = siteBelong.getRemainAmount().add(amt);
    }

}
